<template>
    <tr>
      <td><input type="checkbox" v-model="check"/></td>
      <td>{{name}}</td>
      <td>{{price}}</td>
      <td><button @click="del">-</button>{{num}}<button @click="add">+</button> </td>
      <td>{{sum}}</td>
      <td><button @click="delet">删除</button></td>
    </tr>
</template>
<script>
export default {
  props:['name','price','num','checked','index','all'],
  computed: {
    check:{
      set(val) {
        this.$emit('checks',val,this.index)
      },
      get() {
        return this.all
      }
    },
    sum() {
      return this.price*this.num
    }
  },
  methods:{
    add() {
      // console.log(this.num);
      this.$emit('addBtn',this.num,this.index)
    },
    del() {
      this.$emit('delBtn',this.num,this.index)
    },
    delet() {
      this.$emit('deletBtn',this.index)
    }
  }
}
</script>

<style>
</style>